<script type="text/javascript">
$(function () {
	var url = '${contextPath}script/oa/stock.js';
	$.ajax({url:url, dataType:'script', cache:true,
		success: function(){
		}
	});
});
</script>

<#import "/freemarker/modeltype.ftl" as mt>
<#import "/freemarker/modeltype_entity.ftl" as mte>
<div>
	<h3 class="title"><i class="fontello-icon-th-list-1"></i> 编辑库存信息</h3>
</div>
<h4>&nbsp;&nbsp;</h4>
<div class="widget" >
	<div class="widget-content">
		<form id="editStockForm">
			<table style="width:800px;" class="table table-bordered animate2 fadeInUp">
				<thead>
					<tr height="40">
						<th style="text-align:center; width:150px;">物品名称<a href="javascript:;" onclick="javascript:add_stock();return false;" style="margin-left: 20px">[添加空白行]</a></th>
						<th style="text-align:center; width:40px;">物品类别</th>
						<th style="text-align:center; width:40px;">数量</th>
						<th style="width: 50px">价格（元）</th>
						<th style="width:32px;">操作</th>
					</tr>
				</thead>
				<tbody id="ListBody">
				<#assign i = 0 />
					<tr class="rep">
						<td><div class="input-append">
								<input class="gn" id="gn_${i}" name="itemList[${i}].gn" value="${(stock.gn)!''}" type="text" style="width:200px;" readonly />
								<button class="btn btn-xs btn-primary" pib="${i}" type="button" onclick="javascript:select_stock($(this));return false;"><i class="icon-search"></i></button>
							</div>
							<input id="gc_${i}" name="itemList[${i}].gc" value="${(stock.gc)!''}" type="hidden" />
							<input type="hidden" name="itemList[${i}].code" value="${(stock.code)!''}"/>
						</td>
						 <td><span id="s_${i}"><#if stock?? && stock.sort == 1>消耗品<#elseif stock?? && stock.sort == 2>固定资产<#else>无</#if></span></td>
						<td><input class="cou" type="text" name="itemList[${i}].count" value="${(stock.stockcount)!''}" style="width:40px;" onkeyup="javascript:checkNum_stock($(this));return false;"/></td>
						<td><input class="p" type="text" name="itemList[${i}].price" value="${(item.price)!''}" style="width:40px;"/></td>
						<td style="text-align:center;"><a class="btn btn-danger" href="javascript:;" onclick="javascript:delete_stock($(this));return false;"><i class="icon-remove"></i></a></td>
					</tr>
				<#assign i = i + 1/>
				</tbody>
				<tr height="40">
					<td colspan="5" style="text-align: center;">
						<a href="javascript:;" class="btn btn-info" onclick="javascript: save_stock(); return false;"><i class="icon-save"></i>&nbsp;保&nbsp;&nbsp;存</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<a href="javascript:;" class="btn btn-primary" onclick="javascript: sys_load_handle('stock');return false;"><i class="fontello-icon-block"></i>&nbsp;取&nbsp;&nbsp;消</a>
					</td>
				</tr>
			</table>
		</form>
	</div>
</div>

<input type="hidden" id="index" value="${i}" />
<table id="tempTable" style="display:none;">
	<tr class="rep">
		<td>
			<div class="input-append">
				<input class="gn" type="text" style="width:200px;" readonly />
				<button class="btn btn-xs btn-primary" type="button" onclick="javascript:select_stock($(this));return false;"><i class="icon-search"></i></button>
			</div><input class="gc" type="hidden" />
		</td>
		 <td><span class="s">无</span></td>
		<td><input class="cou" type="text" style="width:40px;" onkeyup="javascript:checkNum_stock($(this));return false;"/></td>
		<td><input class="p" type="text" style="width:40px;"/></td>
		<td style="text-align:center;"><a class="btn btn-danger" href="javascript:;" onclick="javascript:delete_stock($(this));return false;"><i class="icon-remove"></i></a></td>
	</tr>
</table>
